package com.wuyou.simple;

import java.util.Set;
import java.util.TreeSet;

/**
 * 217. 存在重复元素
 */
public class ContainsDuplicate {



    public boolean solution_1(int[] nums){
        Set<Integer> set = new TreeSet<Integer>();
        for (int i = 0; i < nums.length; i++) {
            boolean flag = set.add(nums[i]);
            if (!flag) {
                return true;
            }
        }
        return false;
    }
}
